const { resolve } = require('path')

const Router = require('koa-router')
const router = new Router()

const { MANAGE_BASEROUTER } = require(resolve(__dirname, '../config/default'))

const { verifyToken } = require(resolve(__dirname, '../middleware/index'))

const {
  getUserInfo,
  findUserInfo,
  upUserStatus,
  delUser
} = require(resolve(__dirname, '../routerHandle/managementHandle/user'))

// 查询用户 /api/manage
router.get(MANAGE_BASEROUTER + '/userInfo/find', getUserInfo)

// 搜索用户 /api/manage
router.post(MANAGE_BASEROUTER + '/userInfo/search', verifyToken, findUserInfo)

// 搜索用户 /api/manage
router.post(MANAGE_BASEROUTER + '/userInfo/del', verifyToken, delUser)

// 修改用户权限 /api/manage
router.post(MANAGE_BASEROUTER + '/userInfo/upStatus', verifyToken, upUserStatus)

module.exports = router